Problem with timestamp

I am using the function "intof" to convert date into UNIX timestamp.

//sample code
Date submittedDate
int timestamp
Object o = current
submittedDate = o."Submitted_Date"
timestamp = intOf thisDate
print timestamp"\n"

In my client dates are in German format and the German standard tile is used. When, I convet a date into timestamp, I get wong values.

For example, 30.06.2008 (in German Freitag, 30. Mai 2008)is converted into an int, 1212098400. If I convert the timestamp into date using other tools, I get the date and time 29.6.2009, 22:00:00.

I have the feeling that time standards are different (DXL generates GMT). But, I am not 100% sure. Is there a solution for this problem?
SystemAdmin - Tue Nov 03 06:36:21 EST 2009

Re: Problem with timestamp
Peter_Albert - Tue Nov 03 07:57:12 EST 2009

For timestamp conversion, see e.g. http://www.gaijin.at/en/olsutc.php. There you can check that the timestamp 1212098400 translates into

Local time: 30.05.2008 00:00:00 (this PC is also located in Germany)
UTC / GMT: 29.05.2008 22:00:00

DOORS uses the local time of the Client PC, which in this case is UTC + 2 hours, as May is within daylight savings time.

The other tool you refer to translated the timestamp in UTC.

Regards,

Peter

Re: Problem with timestamp
Peter_Albert - Tue Nov 03 08:22:57 EST 2009

Peter_Albert - Tue Nov 03 07:57:12 EST 2009
For timestamp conversion, see e.g. http://www.gaijin.at/en/olsutc.php. There you can check that the timestamp 1212098400 translates into

Local time: 30.05.2008 00:00:00 (this PC is also located in Germany)
UTC / GMT: 29.05.2008 22:00:00

DOORS uses the local time of the Client PC, which in this case is UTC + 2 hours, as May is within daylight savings time.

The other tool you refer to translated the timestamp in UTC.

Regards,

Peter

I was a bit fuzzy in my previous post. As of DOORS 8.x, DOORS stores UTC in its date attributes (actually taken from the database server time, not the client), but zone adjustments are applied when the data is displayed. The rest remains true: you calculated the timestamp for local (summer-) time using DXL, and converted the result back in UTC, using a different tool.

Peter

Re: Problem with timestamp
SystemAdmin - Tue Nov 03 08:56:02 EST 2009

Hi Peter,

thanx for your reply. My question was not answered in your previous email.

I am using DOORS 9.0. Time format is UTC.

Using DXL function (intof), "Freitag, 30. Mai 2008" is converted into timestamp, 1212098400. I tested this case using another tool in internet. The tool converts, "1212098400" into "29.6.2009, 22:00:00" UTC. This means, time converstion is not correct.

Up to my understanding, DXL in my client is converting "UTC -> GMT -> Timestamp". Is there a way to get Timestamp for UTC?

Anil.

Re: Problem with timestamp
Peter_Albert - Tue Nov 03 10:33:40 EST 2009

SystemAdmin - Tue Nov 03 08:56:02 EST 2009
Hi Peter,

thanx for your reply. My question was not answered in your previous email.

I am using DOORS 9.0. Time format is UTC.

Using DXL function (intof), "Freitag, 30. Mai 2008" is converted into timestamp, 1212098400. I tested this case using another tool in internet. The tool converts, "1212098400" into "29.6.2009, 22:00:00" UTC. This means, time converstion is not correct.

Up to my understanding, DXL in my client is converting "UTC -> GMT -> Timestamp". Is there a way to get Timestamp for UTC?

Anil.

Hi Anil,

are you sure the timestamp 1212098400 is converted into 29.6.2009, 22:00:00" UTC using your tool? I tested several online tools, and they all convert 1212098400 correctly into 29.05.2008 22:00:00.

> Up to my understanding, DXL in my client is converting "UTC -> GMT -> Timestamp". Is there a way to get Timestamp for UTC?

UTC and GMT is the same (almost, up to a fraction of a second). Probably you meant MEZ? Even then, I would say that the understanding is not fully correct.

When you calculate the timestamp of a date variable, DOORS does "UTC -> timestamp" directly, as it does not display the date to the user.

When you specify a date manually à la "Date d = "30 May 2008", DOORS assumes that the date is in local time, hence the conversion goes "MEZ -> UTC -> Timestamp".

So the only problem occurs when you want to specify a date manually, and at the same time want to tell DOORS that the specified date is in UTC. In that case, I know of no other way as to manually take care of the correct subtraction / addition of hours.
Regards,

Peter

Re: Problem with timestamp
SystemAdmin - Tue Nov 03 10:57:03 EST 2009

Peter_Albert - Tue Nov 03 10:33:40 EST 2009
Hi Anil,

are you sure the timestamp 1212098400 is converted into 29.6.2009, 22:00:00" UTC using your tool? I tested several online tools, and they all convert 1212098400 correctly into 29.05.2008 22:00:00.

> Up to my understanding, DXL in my client is converting "UTC -> GMT -> Timestamp". Is there a way to get Timestamp for UTC?

UTC and GMT is the same (almost, up to a fraction of a second). Probably you meant MEZ? Even then, I would say that the understanding is not fully correct.

When you calculate the timestamp of a date variable, DOORS does "UTC -> timestamp" directly, as it does not display the date to the user.

When you specify a date manually à la "Date d = "30 May 2008", DOORS assumes that the date is in local time, hence the conversion goes "MEZ -> UTC -> Timestamp".

So the only problem occurs when you want to specify a date manually, and at the same time want to tell DOORS that the specified date is in UTC. In that case, I know of no other way as to manually take care of the correct subtraction / addition of hours.
Regards,

Peter

Sorry, I messed up several things. I got the answer as well.